Skip to content

Conversation

@fee1-dead
Copy link
Member

@fee1-dead fee1-dead commented Dec 2, 2025

For half-open ranges, specifies that the upper bound cannot be the minimum.

Also specify that this only applies to range patterns and not also expressions.

Fixes #149165

@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

Some changes occurred in match checking

cc @Nadrieril

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 2, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 2, 2025

r? @SparrowLii

rustbot has assigned @SparrowLii.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me modulo maybe a diagnostic wording nit

View changes since this review

fn main() {
m!(0, ..u8::MIN);
//~^ ERROR lower range bound must be less than upper
//~^ ERROR upper bound for a range pattern cannot be the minimum
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussion: this is specifically applicable to the half-open range pattern, right? Because ..=u8::MIN-the-closed-range would be fine. Maybe say

ERROR: upper bound for a half-open range pattern cannot be the minimum

WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure what a half-open range means, actually.. apparently a..b is called half-open? So I'd have to investigate the wording

Copy link
Member

@jieyouxu jieyouxu Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It refers to one of [a, b) or (a, b] where one of the ends are exclusive. In our case, a..b is the [a, b) right-side half-open range. However, if this phrase isn't familiar to you, then we should probably not use it since you won't be the only one unfamiliar with the phrase. (I suppose this is only a familiar wording given some discrete math courses or whatever, so yeah...)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could also be phrased as, "exclusive upper bound for a range bound cannot be the minimum".

@jieyouxu
Copy link
Member

jieyouxu commented Dec 2, 2025

r? me

@rustbot rustbot assigned jieyouxu and unassigned SparrowLii Dec 2, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Dec 2, 2025

Ignore the wording nit, feel free to r=me once PR CI is green.

For half-open ranges, specifies that the upper bound cannot be the minimum.

Also specify that this only applies to range patterns and not also expressions.
@fee1-dead
Copy link
Member Author

@bors r=jieyouxu rollup

@bors
Copy link
Collaborator

bors commented Dec 2, 2025

📌 Commit f8ca417 has been approved by jieyouxu

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 2, 2025
@bors
Copy link
Collaborator

bors commented Dec 3, 2025

⌛ Testing commit f8ca417 with merge 040c599...

bors added a commit that referenced this pull request Dec 3, 2025
reword error for invalid range patterns

For half-open ranges, specifies that the upper bound cannot be the minimum.

Also specify that this only applies to range patterns and not also expressions.

Fixes #149165
@bors
Copy link
Collaborator

bors commented Dec 3, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 3, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2025

fatal: unable to access 'https://github.com/rust-lang/cargo.git/': The requested URL returned error: 403
fatal: clone of 'https://github.com/rust-lang/cargo.git' into submodule path '/home/runner/work/rust/rust/src/tools/cargo' failed
Failed to clone 'src/tools/cargo' a second time, aborting
The command has failed after 5 attempts.

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 3, 2025
@rust-log-analyzer
Copy link
Collaborator

A job failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2025

Huh. Maybe transient git operation issue?
@bors retry

@bors
Copy link
Collaborator

bors commented Dec 3, 2025

⌛ Testing commit f8ca417 with merge 6dc2a75...

bors added a commit that referenced this pull request Dec 3, 2025
reword error for invalid range patterns

For half-open ranges, specifies that the upper bound cannot be the minimum.

Also specify that this only applies to range patterns and not also expressions.

Fixes #149165
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@bors
Copy link
Collaborator

bors commented Dec 3, 2025

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Dec 3, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Dec 3, 2025

I suspect x86_64-gnu-tools is currently borked, which means PR CI (and thus Merge CI) is now currently red...

Tracking issue: #149575

Infra thread: #t-infra > `src/doc/reference` doctest failures.

@/bors treeclosed=1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

..i32::MIN pattern gives error mentioning "lower range bound"

6 participants